package mk.basic;

public class Charge {

	public static void main(String[] args) {
		// 잔돈 계산하는 프로그램
		
		int charge;
		int W10;
		int W50;
		int W100;
		int W500;
		int W1000;
		int W5000;
		int W10000;
		int W50000;
		int rest;
		
		//charge = 876543210;
		charge = 876_543_210;  //JDK7, 자릿수구분 _
		W50000 = charge / 50000;
		
		rest   = charge - (W50000*50000);
		W10000 = rest / 10000;
		
		rest   = rest - (W10000*10000);
		W5000  = rest / 5000;
		
		rest   = rest - (W5000*5000);	
		W1000  = rest / 1000;
		
		rest   = rest - (W1000*1000);
		W500   = rest / 500;
		
		rest   = rest - (W500*500);
		W100   = rest / 100;
		
		rest   = rest - (W100*100);
		W50    = rest / 50;
		
		rest   = rest - (W50*50);
		W10    = rest / 10;
		
		System.out.println("50000원권"+ W50000 + "장");
		System.out.println("10000원권"+ W10000 + "장");
		System.out.println("5000원권"+ W5000 + "장");
		System.out.println("1000원권"+ W1000 + "장");
		System.out.println("500원권"+ W500 + "개");
		System.out.println("100원권"+ W100 + "개");
		System.out.println("50원권"+ W50 + "개");
		System.out.println("10원권"+ W10 + "개");
		
	}

}
